<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'jobs-form',
    'enableAjaxValidation' => false
        ));
?>
<h1>Job for:</h1>
<br/>
<strong><?= $model->location->locname . "({$model->location->custno}-{$model->location->locno})" ?></strong>
<div class="form">
<div class="row" style="height:80px">
    <table style=" width: 755px;">
        <tr>
            <td style=" width: 363px;">
                <script>
                    $(document).ready(function(){
                        
                        
                    $('#Jobs_billloc').click(function(){
                        
                       $.ajax({
                           url:'index.php?r=jobs/getlocation&locid='+$(this).val(),
                           timeOut:3000,
                           success:function(data){
                               data=$.parseJSON(data);
                               $('#billadd1').html(data.add1);
                               $('#billadd2').html(data.add2);
                               $('#billcsz').html(data.city+' '+data.state+' '+data.zip);
                           }
                       }); 
                    });
                });
                </script>
                <?php echo $form->labelEx($model, 'billloc'); ?>
                <br clear="all">
             
                <?php

                echo $form->dropDownList($model,'billloc',$model->getBillToList(),array('disabled'=>'disabled'));
                echo $form->error($model, 'billloc');
                ?> 
             <br clear="all">
                <?php if(isset($model->billLocation) && $model->billLocation!=NULL):?>
                
                <span id='billadd1'><?=$model->billLocation->add1?></span><br/>   
          
                <span  id='billadd2'><?=$model->billLocation->add2?></span><br/>                
   
                <span id='billcsz'><?=$model->billLocation->city.' '.$model->billLocation->state.' '.$model->billLocation->zip?></span><br/>
                <?php else:?>
                <span  id='billadd1'><?=$model->customer->add1?></span><br/>   
          
                <span  id='billadd2'><?=$model->customer->add2?></span><br/>                
   
                <span id='billcsz'><?=$model->customer->city.' '.$model->customer->state.' '.$model->customer->zip?></span><br/>
                <?php endif?>
             
            </td>
            <td id="ext-gen1159">

              
                <label>Ship to:</label>
                <div class="clear"></div>
                <div class='model-data'><?=$model->location->locname?></div>
                   <div class="clear"></div>
                    <?=$model->location->add1?><br/>
                
                <?=$model->location->add2?><br/>
              
                <?=$model->location->city.' '.$model->location->state.' '.$model->location->zip?><br/>
           
                    
                 
            </td>

        </tr>
    </table>

</div>
<br clear="both"/>  <br clear="both"/> <br clear="both"/>
<?php echo $form->hiddenField($model,'custno');?>
<?php echo $form->hiddenField($model,'locno');?>
<div class="left-column">
    <div class="row short">
        <?php echo $form->labelEx($model, 'jobid'); ?>
        <div class="model-data">
            <?php echo $model->jobid; ?>
        </div>
        
        <?php echo $form->error($model, 'jobid'); ?>
    </div>
<div class="row short">
    <?php echo $form->labelEx($model, 'department'); ?>
    <?php echo $form->dropDownList($model, 'department', SalesDepartments::getListData(),array('disabled'=>'disabled')); ?>
    <?php echo $form->error($model, 'department'); ?>
</div>
<div class="row short">
    <?php echo $form->labelEx($model, 'supervisor'); ?>
    <?php echo $form->dropDownList($model, 'supervisor', Employees::model()->getEmployeeList(),array('disabled'=>'disabled')); ?>
    <?php echo $form->error($model, 'supervisor'); ?>
</div>
<div class="row short">
    <?php echo $form->labelEx($model, 'jobsalesperson'); ?>
    <?php echo $form->dropDownList($model, 'jobsalesperson', Employees::model()->getSalePersonList(),array('disabled'=>'disabled')); ?>
    <?php echo $form->error($model, 'jobsalesperson'); ?>
</div>

<div class="row short">
    <?php echo $form->labelEx($model, 'customerpo'); ?>
    <?php echo $form->textField($model, 'customerpo'); ?>
    <?php echo $form->error($model, 'customerpo'); ?>
</div>
<div class="row short">
    <?php echo $form->labelEx($model,'jobclass');?>
    <?php echo $form->dropDownList($model,'jobclass',  JobsClass::getList(),array('disabled'=>'disabled'));?>
    <?php echo $form->error($model,'jobclass');?>
</div>


</div>
<div class="right-column">
    <div class="row short">
        <?php echo $form->labelEx($model, 'start'); ?>
        <div class='model-data'><?php echo $model->start ?></div>
        <?php echo $form->error($model, 'start'); ?>
    </div>
    <div class="row short">
        <?php echo $form->labelEx($model, 'projend'); ?>
        <div class='model-data'><?php echo $model->projend ?></div>
        <?php echo $form->error($model, 'projend'); ?>
    </div>
    <div class="row short">
        <?php echo $form->labelEx($model, 'actualend'); ?>
        <div class='model-data'><?php echo $model->actualend ?></div>
        <?php echo $form->error($model, 'actualend'); ?>
    </div>
    <div class="row short">
        <?php echo $form->labelEx($model, 'closedate'); ?>
         <div class='model-data'><?php echo $model->actualend ?></div>
        <?php echo $form->error($model, 'closedata'); ?>
    </div>
    <div class="row short">
        <?php echo $form->labelEx($model, 'installcrew'); ?>
        <?php echo $form->dropDownList($model,'installcrew',Employees::model()->getEmployeeList(),array('disabled'=>'disabled')); ?>
        <?php echo $form->error($model, 'installcrew'); ?>
    </div>
    <div class="row short">
        <?php echo $form->labelEx($model, 'jobstatus'); ?>
        <?php echo $form->dropDownList($model, 'jobstatus', JobsStatus::getListData(),array('disabled'=>'disabled')); ?>
        <?php echo $form->error($model, 'jobstatus'); ?>
    </div>
</div>
<div class="row">
   
    <a href="javascript:void(0)" onclick="insertAtCaret('Jobs_description',getDate()+' ');">Insert Date/Time</a>
    <br/>
<?php echo $form->textArea($model, 'description',array('style'=>'width:1000px;')); ?>
<?php echo $form->error($model, 'description'); ?>
</div>
</div>
<?php $this->endWidget() ?>


